package com.schoolgard.base.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.schoolgard.entitybean.Users;

public class LoginInterceptor extends MethodFilterInterceptor{
	
	private static final long serialVersionUID = 201112042042L;

	/**
	 * 登录拦截器截器
	 */
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {

		ActionContext actionContext = invocation.getInvocationContext();
	    Map session=actionContext.getSession();  
        Users user = (Users)session.get("users");
        if(user != null ){ //TODO并且用户是可用状态的
        	return invocation.invoke();
        }
		return Action.LOGIN;
	}

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		return null;
	}
}
